﻿using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Text.Editor;

namespace CodeJumper
{
    class KeyboardProcessor : KeyProcessor
    {

        private IWpfTextView _textView;
        ElementView elementView;

        public KeyboardProcessor(IWpfTextView wpfTextView)
        {
            Trace.WriteLine("KeyboardProcessor created.");
            this._textView = wpfTextView;
        }

        public override void PreviewKeyDown(System.Windows.Input.KeyEventArgs args)
        {
            //try
            //{
            //    if (this.elementView == null)
            //    {
            //        this._textView.Properties.TryGetProperty<ElementView>("ElementViewUI", out this.elementView);
            //    }
            //    if ((this.elementView != null) && this.elementView.IsMouseOver && args.Key == System.Windows.Input.Key.Home)
            //    {
            //        this.elementView.scrollViewer1.ScrollToHome();
            //    }
            //}
            //catch (Exception)
            //{
            //}

            base.PreviewKeyDown(args);
        }

        public override void PreviewKeyUp(System.Windows.Input.KeyEventArgs args)
        {
            //try
            //{
            //    if (this.elementView == null)
            //    {
            //        this._textView.Properties.TryGetProperty<ElementView>("ElementViewUI", out this.elementView);
            //    }
            //    if ((this.elementView != null) && this.elementView.IsMouseOver && args.Key == System.Windows.Input.Key.Home)
            //    {
            //        this.elementView.scrollViewer1.ScrollToHome();
            //    }
            //}
            //catch (Exception)
            //{
            //}

            base.PreviewKeyUp(args);
        }

    }
}
